<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title></title>
	<meta charset="utf-8" />
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<link rel="stylesheet" href="../../css/public.css" media="all" />
	<script src="../../layui/layui.all.js"></script>
	<script src="../../layui/lay/modules/laytpl.js"></script>
	<script>
		var data = null;
        window.onload = function () {
            var $ = layui.jquery;
			$.post({
				url:"/school/queryAllSchoolBuildRoom",
				async:false,
				success: function (res) {
					console.log(res);
					data = res;
                }
			});

            var laytpl = layui.laytpl;
            //建立视图。用于呈现渲染结果。
            var gettpl = document.getElementById('testTpl').innerHTML;
            laytpl(gettpl).render(data, function (html) {
                console.log(html)
                //得到的模板渲染到html
                document.getElementById('testDiv').innerHTML = html;
            });
        }
	</script>
</head>
<body>
<script id="testTpl" type="text/html">
	<ul id="aat" lay-filter="demo">
		{{# for(var i = 0; i < d.data.length; i++){ }}
		<li class='nav-item'>
			<a href='javascript:;'>
				<span>{{ d.data[i].p }}</span>
				<i class='layui-icon nav-icon'>&#xe625;</i>
			</a>
			{{# for(var j = 0; j < d.data[i].build.length; j++){ }}
			<ul class="aat2">
				<li class='nav-item2'>
					<a name='t1' schoolId=204 tBuildName=A栋 tBuildID=1 href='javascript:;'>&nbsp;&nbsp;
						<span>{{ d.data[i].build[j].c }}</span>
						<i class='layui-icon nav-icon'>&#xe625;</i>
					</a>
					<ul>
						{{# for(var k = 0; k < d.data[i].build[j].room.length; k++){ }}
						<li>
							<a name='t2' schoolId=203 tBuildName=A栋 tBuildID=4 classroomID="A001" href=''>&nbsp;&nbsp;
								<span>{{ d.data[i].build[j].room[k].r }}</span>
							</a>
						</li>
						{{# } }}
					</ul>
				</li>
			</ul>
			{{# } }}
		</li>
		{{# } }}
	</ul>
</script>
<div id="testDiv" class="nav"></div>
<!--<script type="text/javascript" src="../../layui/layui.js"></script>-->
</body>
</html>